package com.ui.element;

import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class HexDialog extends JDialog{

	private static final long serialVersionUID = 5340226313469933687L;
	
	public HexDialog(JFrame owner, boolean modal) {
		super(owner, modal);
	}

	protected void setTitle(String title,String logourl ){
		super.setTitle(title);
		try {
			Image logo = ImageIO.read(this.getClass().getResource("/img/tp16.png"));
			super.setIconImage(logo);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void setSize(int w,int h ){
		// super.setLocationRelativeTo(null);
		double lx = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
		double ly = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
		super.setLocation(new Point((int) (lx / 2) - w / 2, (int) (ly / 2) - h / 2));// �趨���ڳ���λ��
		super.setSize(w, h);
		super.setResizable(false);
	}
	
	protected void alertError(String msg) {
		JOptionPane.showMessageDialog(null, msg, EleConsts.FONT_ARIAL, JOptionPane.ERROR_MESSAGE);
	}

}
